package com.topisv.tms.rest.qimen.command;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.topisv.tms.exception.PaiUException;
import com.topisv.tms.rest.qimen.qmservice.AllCancelService;
import com.topisv.tms.rest.qimen.request.RequestMethodType;
import com.topisv.tms.rest.qimen.request.RequestParams;
import com.topisv.tms.rest.qimen.response.ResponseParams;

@Component
@Lazy(false)
@Transactional(readOnly =  false)
public class AllCancelCommand  implements IQMRequestCommand,InitializingBean  {
	
	protected Logger log = LoggerFactory.getLogger(getClass());
	
	@Autowired
	AllCancelService allCancelService;
	
	
	@Transactional(readOnly = false,rollbackFor=Exception.class,propagation=Propagation.REQUIRED)
	public ResponseParams execute(RequestParams params)throws PaiUException{
		return allCancelService.execute(params);
	}
	

	@Override
	public void afterPropertiesSet() throws Exception {
		QMRequestCommandContainer.getInstance().add(RequestMethodType.ALL_CANCEL.getType(), this);
	}


	@Override
	public void executeBefore(ResponseParams qmResponseParams) throws PaiUException {
		allCancelService.executeBefore();
	}



      
    
}
